﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />


    <title>Danh hien Jewelry @ViewBag.Title</title>

    <link rel="SHORTCUT ICON" href="@Html.BaseUrl()ico.ico" />
    <link rel="shortcut icon" type="image/x-icon" href="@Html.BaseUrl()ico.ico" />

   
    @Styles.Render("~/Content/kendo/css")
    @Styles.Render("~/Content/default/css")
    @Scripts.Render("~/scripts/js")
    
    <style type="text/css">
    body
    {
        background: #fff;
        font-family: @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.Font;
        font-size: @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.FontSize;
        color: #666666;
        margin: 0;
        padding: 0;
        overflow:hidden;


    }
    .ModuleTitle
    {
        font-size: @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.ModuleTitleSize();
    }

    .ModuleTitleLeft
    {
        font-size: @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.ModuleTitleSize();
    }

    .GroupTitle
    {
        font-size: @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.GroupTitleSize();
    }

    .mtitle
    {
        font-size: @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.FormTitle();
        padding-left: 10px;
        padding-top: 2px;
        color: #0000FF;
        clear: both;
    }

    .ApplicationTitle
    {
        font-size: @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.ApplicationTitle();
        color:whitesmoke;
    }

    .buttons button {
	    font-size: @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.FontSize;
    }

    .k-tabstrip
    {
        border-width:0px !important;
    }
    </style>


</head>
<body>

    <script type="text/javascript">
        var managewindow = new Array(0);
        var BaseUrl = '@Html.BaseUrl()';
    </script>

    <div class="content">
        <div id="divHeader" class="header">
            <div class="content" style="height:55px">
                <div style="float:left;margin:5px">
                    <div style="float:left;margin-top:5px">
                        <img src="@Html.ContentPath("default/images/logo.png")" width="40px" height="40px" />
                    </div>
                    <div style="float:left;margin-top:12px;margin-left:10px">
                        <span class="ApplicationTitle">
                            Danh Hiển Jewelry
                        </span>
                    </div>

                </div>
                <div style="display: block;width:200px; height:100%;float:right; margin-top:2px; margin-right:5px;text-align:right;margin-right:10px;position:relative">
                    <div>
                        <a href='@Url.Action("ChangePassword", "Home")' style="text-decoration:none;color: #d6d5dc">@Html.LOBHtmlHelper().T("ChangePassword") | </a>
                        <a href='@Url.Action("Logout", "Home")' style="text-decoration:none;color: #d6d5dc">@Html.LOBHtmlHelper().T("Logout")</a>
                    </div>
                    <div style="bottom:0px;position:absolute;text-align:right;width:100%">
                        <span style="color:#d6d5dc" id="time">ssss</span>
                    </div>
                </div>
            </div>
        </div>

        @{Html.RenderAction("LeftMenu", "Shared");}

    </div>
    <div class="barright">



        <div id="tabstrip" style="height:600px">
            <ul id="tabheader">
                <li class="k-state-active">
                    Dashboard
                </li>
            </ul>

            <div class="workspace" style="background: url('Content/default/images/mainbg.jpg')"></div>

        </div>





    </div>
    </div>
    <div id="divbottom" class="barbottom">
        <div style="float:left;margin-left:10px;margin-top:4px">
            <label>Danh Hiển Jewelry Copyright 2014</label>
        </div>
        <div style="float:right;margin-right:10px;margin-top:4px">
            <label>@Html.LOBHtmlHelper().T("UserName"): @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.UserName   |   @Html.LOBHtmlHelper().T("DataBase"): @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.ConnectionName |   @Html.LOBHtmlHelper().T("Language"): @LineOfBusiness.Core.Helper.CacheHelper.LoginUser.Language</label>
        </div>
    </div>
    </div>
    <script>
        var itemSelect = null;
        var tabStrip = null;
        var tabCount = 1;
        var isresize = false;
        var rx = 0, ry = 0;
        var windowModule = null;
        $(document).ready(function () {

            showTime();
            $("#treeview").kendoTreeView();
            $("#Ul1").kendoTreeView();
            $("#Ul2").kendoTreeView();
            $(".k-treeview").css("overflow", "auto");
            $("#autofunction").attr("placeholder","@Html.LOBHtmlHelper().T(" Search function....")");

            resize();

            $('.divmodule').fadeOut();

            if ($.cookie("lastmodule") != null) {
                $('#module_' + $.cookie("lastmodule")).fadeIn();
                $(".headertitle")[0].innerHTML = $("#" + $.cookie("lastmodule"))[0].innerHTML.replace('class="moduletext"', 'class="moduletextHeader"');
                $("#" + $.cookie("lastmodule")).css("background", "url('@Html.BaseUrl()Content/default/images/moduleclick.png') repeat-x");
                itemSelect = $("#" + $.cookie("lastmodule"));

                $('#dashboard').attr('src', "@Url.Action("Index","Dashboar")?module=" + $.cookie("lastmodule"));
            }
            else {
                $('#module_AD').fadeIn();
                $(".headertitle")[0].innerHTML = $("#AD")[0].innerHTML.replace('class="moduletext"', 'class="moduletextHeader"');
                $("#AD").css("background", "url('@Html.BaseUrl()Content/default/images/moduleclick.png') repeat-x");
                itemSelect = $("#AD");
                $('#dashboard').attr('src', "@Url.Action("Index","Dashboar")?module=AD");
            }



            $(".moduleitem").click(function () {
                $(".moduleitem").css("background", "url('@Html.BaseUrl()Content/default/images/module.png') repeat-x");

                $(this).css("background", "url('@Html.BaseUrl()Content/default/images/moduleclick.png') repeat-x");
                $(".headertitle")[0].innerHTML = $(this)[0].innerHTML.replace('class="moduletext"', 'class="moduletextHeader"');

                itemSelect = this;

                $('.divmodule').fadeOut();

                $.cookie("lastmodule", $(this)[0].id, { expires: 356 });

                $('#module_' + $(this)[0].id).fadeIn();
                tabStrip.select(0);

                $('#dashboard').attr('src', "@Url.Action("Index","Dashboar")?module=" + $(this)[0].id);
                @*                    if ($(this)[0].id == "CS")
                        $('#dashboard').attr('src', "@Url.Action("IndexCS","Dashboar")");
                    else if ($(this)[0].id == "SR" || $(this)[0].id == "PP")
                        $('#dashboard').attr('src', "@Url.Action("IndexSR","Dashboar")");
                    else if ($(this)[0].id == "IV")
                        $('#dashboard').attr('src', "@Url.Action("IndexIV","Dashboar")");
                    else
                        $('#dashboard').attr('src', "@Url.Action("Index","Dashboar")");
                *@

            });

            $(".moduleitem").mouseout(function () {
                if (itemSelect != this) {
                    $(this).css("background", "url('@Html.BaseUrl()Content/default/images/module.png') repeat-x");
                }
            });

            $(".moduleitem").mousemove(function () {
                if (itemSelect != this) {
                    $(this).css("background", "url('@Html.BaseUrl()Content/default/images/modulehover.png') repeat-x");
                }
            });

            tabStrip = $("#tabstrip").kendoTabStrip({
                animation: {
                    // fade-out current tab over 1000 milliseconds
                    close: {
                        effects: "fadeOut"
                    },
                    // fade-in new tab over 500 milliseconds
                    open: {
                        effects: "fadeIn"
                    }
                }
            }).data("kendoTabStrip");


            $("#divMid").kendoSplitter({
                panes: [
                    { collapsible: false, size: "200px" },
                    { collapsible: false}
                ]
            });

            windowModule = $("#windowmodule");
            windowModule.hide();
        });



        $(window).resize(function () {
            resize();
        });

        $(window).load(function () {
            if ('@LineOfBusiness.Core.Helper.CacheHelper.LoginUser.FirstChange' == 'True')
            {
                OpenForm("/UserAccount/ChangePassword", 430, 170, '1', "Change password", true, 'ADSU04');
            }
            else if('@LineOfBusiness.Core.Helper.CacheHelper.LoginUser.AlertExpire' == 'True')
            {
                ShowMessage("Infomation", "PasswordExpired", "Password will expired in {0} day? do you want change password", function (e) {
                    if(e=='YES')
                        OpenForm("/UserAccount/ChangePassword", 430, 170, '1', "Change password", true, 'ADSU04');
                }, "@LineOfBusiness.Core.Helper.CacheHelper.LoginUser.Expire", "YesNo");
            }
        });

        function showTime() {
            var today = new Date();
            var d = kendo.toString(today, 'dd MMMM yyyy - hh:mm:ss','en');
            $("#time").text(d);
            t = setTimeout('showTime()', 1000);
        }

        function checkTime(i) {
            if (i < 10) {
                i = "0" + i;
            }
            return i;
        }


        function SelectFunction(e)
        {
            var nametab = "";
            var model = this.dataItem(e.node);
            var modelNew = {};
            

            var url = model.urlFunction;
            _SelectFunction(model, url);
            

            var nameTree = e.sender.wrapper[0].id;

            setTimeout(function ()
            {
                var treeView = $("#" + nameTree).data("kendoTreeView");
                treeView.select($());
            }, 1000);

        }

        function _SelectFunction(model, url,nametab)
        {
            nametab = nametab || "";
            if (IsNullOrEmty(url)) return;

            var per = PostServer('@Url.Action("GetExecPer", "Shared")?type=1&functionID=' + model.id);
            if (!per.Active) {
                ShowMessage('AccNet i', 'YouNotPermission', 'You not permission for this function.', null, null, 'OK');
                return
            }

            //$('#busyMain').show();
            if (model.displayMode == "1") {
                for (i = 0; i < managewindow.length; i++) {
                    if (managewindow[i].name == model.id + nametab) {
                        managewindow[i].restore();
                        managewindow[i].toFront();
                        return;
                    }
                }
                OpenForm(url, model.width, model.height, '1', model.CustomName, false, model.id + nametab);
            }
            else if (model.displayMode == "2") {
                window.open(url);
            }
            else {
                //$('#loader').attr('src', url);
                if (url != "" && url != null) {
                    var exist = $(tabStrip)[0].element.find('span[id="' + (model.id + nametab) + '"]');
                    if (exist.length == 0) {
                        tabStrip.append({
                            text: '<span id="' + (model.id + nametab) + '"> ' + model.CustomName + ' </div><img style = "width:12px;height:12px" onclick="removeTab()" src="@Html.BaseUrl()Content/images/toolbar/close.png"/>',
                            encoded: false,
                            content: '<div class="workspace"><iframe sandbox="allow-popups allow-same-origin allow-top-navigation allow-forms allow-scripts"  style="width:100%;height:100%;" frameBorder="0"  src="' + url + '"></iframe></div>'
                        });
                        tabCount = tabCount + 1;
                        tabStrip.select(tabCount - 1);
                    }
                    else {
                        tabStrip.select(exist[0].parentElement.parentElement);
                    }
                }
            }
        }
        function onselectauto(e) {
            var dataItem = this.dataItem(e.item.index());
            var url = dataItem.urlFunction;
            _SelectFunction(dataItem, url);
        }

        function loadframe()
        {
            // $('#busyMain').hide();
        }

        jQuery(document).bind('keydown', function (evt) {
            //key t
            if (evt.shiftKey == true && evt.keyCode == 84)
            {
                evt.preventDefault();
                if (document.getElementById("divtoolbar").style.display == "none") {
                    ShowControl("divtoolbar");
                }
                else {
                    HideControl("divtoolbar");
                }
                resize();
            }

            //key b
            if (evt.shiftKey == true && evt.keyCode == 66) {
                evt.preventDefault();
                if (document.getElementById("divbottom").style.display == "none") {
                    ShowControl("divbottom");
                }
                else {
                    HideControl("divbottom");
                }
                resize();
            }

            //key a
            if (evt.shiftKey == true && evt.keyCode == 65) {
                evt.preventDefault();
                if (document.getElementById("divHeader").style.display == "none") {
                    ShowControl("divHeader");
                }
                else {
                    HideControl("divHeader");
                }
                resize();
            }

        });

        function removeTab()
        {
            var tab = tabStrip.select(),
            otherTab = tab.next();
            otherTab = otherTab.length ? otherTab : tab.prev();

            tabStrip.remove(tab);
            tabStrip.select(otherTab);
            tabCount = tabCount - 1;
        }
    </script>

</body>
</html>
